﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace Palsta.Core.action
{
    class JSBlock
    {
        #region Members

        private String js = "";
        private HashSet<String> references = new HashSet<string>();

        #endregion

        #region Constructors

        public JSBlock() { }

        public JSBlock(String js)
        {
            this.js = js;
        }

        #endregion

        #region Accessors

        public virtual String JS
        {
            get
            {
                return this.js;
            }
            set
            {
                this.js = value;
            }
        }

        public virtual HashSet<String> ReferenceFields
        {
            get
            {
                return this.references;
            }
            set
            {
                this.references = value;
            }
        }

        #endregion

        #region Methods

        public void AppandReference(JSBlock jsb)
        {
            this.references.UnionWith(jsb.references);
        }

        public void Appand(JSBlock jsb)
        {
            this.js = this.js + jsb.js;
            this.AppandReference(jsb);
        }

        #endregion

        #region Override Operators

        #endregion

        #region Static Methods

        #endregion
    }
}
